/*
 * @Author: huyuhang
 * @Data:
 * @LastEditors: huyuhang
 * @LastEditTime: 2024-02-27 18:37:37
 * @Description: 数据源模块增删改查接口
 */
import request from '@/config/axios'

// 创建数据源
export const createDataSource = async (data) => {
  return await request.postOriginal({
    url: '/amp/data-source/add',
    data: data
  })
}

// 更新数据源
export const updateDataSource = async (data) => {
  return await request.postOriginal({
    url: '/amp/data-source/edit',
    data: data
  })
}

// 删除数据源
export const deleteDataSource = (data) => {
  return request.postOriginal({
    url: '/amp/data-source/delete',
    data
  })
}

// 获得数据源
export const getDataSource = (id) => {
  return request.get({
    url: '/amp/data-source/get?id=' + id
  })
}

//获取数据源分页
export const getDataSourceList = async (params) => {
  return await request.getOriginal({
    url: '/amp/data-source/page',
    params
  })
}

//获取资产类型枚举
export const getAssetTypeList = (params?: object) => {
  return request.get({
    url: '/amp/data-source/asset-type',
    params
  })
}

//导出
export const exportDataSource = (params?: object) => {
  return request.download({
    url: '/amp/data-source/export-file',
    params
  })
}

//下载导入数据源模版
export const downloadTemplate = () => {
  return request.download({
    url: '/amp/data-source/download-file'
  })
} //导入
export const importDataSource = (data?: object) => {
  return request.upload({
    url: '/amp/data-source/import-file ',
    data
  })
}
